package common;



public class Position3D {

	private Point3D center = new Point3D(0, 0, 0);
	private Point3D face = new Point3D(0, 0, 1);
	private Point3D up = new Point3D(0, 1, 0);
	private Point3D left = new Point3D(1,  0,0);

	
	public Position3D() {
	}
	
	public Position3D(Point3D center, Point3D face, Point3D up, Point3D left) {
		this.center = center;
		this.face = face;
		this.up = up;
		this.left = left;
	}

	public void initilize() {
	}

	public void move(double x, double y, double z) {
		center.x += x;
		center.y += y;
		center.z += z;
	}

	public void rotateNormal(double ax, double ay, double az) {
		face.rotate(ax, ay, az);
		up.rotate(ax, ay, az);
		left.rotate(ax, ay, az);
	}

	public void rotate(double ax, double ay, double az) {
		face.rotate(ax, ay, az);
		up.rotate(ax, ay, az);
		left.rotate(ax, ay, az);
		center.rotate(ax, ay, az);
	}

	public void rotateAgainst(Point3D left, Point3D up, Point3D face){
		this.face.rotateAgainst(left, up, face);
		this.up.rotateAgainst(left, up, face);
		this.left.rotateAgainst(left, up, face);
		this.center.rotateAgainst(left, up, face);
	}
	
	public void rotateWith(Point3D left, Point3D up, Point3D face){
		this.face.rotateWith(left, up, face);
		this.up.rotateWith(left, up, face);
		this.left.rotateWith(left, up, face);
		this.center.rotateWith(left, up, face);
	}	

	public Point3D getCenter() {
		return center;
	}

	public void setCenter(Point3D center) {
		this.center = center;
	}

	public Point3D getFace() {
		return face;
	}

	public void setFace(Point3D face) {
		this.face = face;
	}

	public Point3D getUp() {
		return up;
	}

	public void setUp(Point3D up) {
		this.up = up;
	}

	public Point3D getLeft() {
		return left;
	}

	public void setLeft(Point3D left) {
		this.left = left;
	}

	public void copy(Position3D position){
		this.getCenter().copy(position.getCenter());
		this.getUp().copy(position.getUp());
		this.getFace().copy(position.getFace());
		this.getLeft().copy(position.getLeft());
	}
	
	public Position3D clone(){
		Position3D p = new Position3D();
		p.center = this.center.clone();
		p.face = this.face.clone();
		p.up = this.up.clone();
		p.left = this.left.clone();
		return p;
	}

}